package com.example.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @Classname DemoMapper
 * @Description TODO
 * @Date 2021/4/28 22:00
 * @Created by yin
 */
@Mapper
public interface DemoMapper {
    @Insert("insert into test values(#{name},#{money}) ")
    void insert(String name, Integer money);

    @Insert("update test set money = money + #{money} where name = #{name}")
    void add(String name, Integer money);

    @Insert("update test set money = money - #{money} where name = #{name}")
    void minus(String name, Integer money);

    @Select("select * from test")
    List<Map<String,Object>> getAll();
}
